/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 adv_object_image.h

	$Header: /heroes4/adv_object_image.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( ADV_OBJECT_IMAGE_H_INCLUDED )
#define ADV_OBJECT_IMAGE_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <memory>

#include "abstract_bitmap.h"
#include "pixel_24.h"
#include "screen_point.h"

class t_adv_object_image;
class t_adv_object_image_visitor;
class t_adv_object_image_visitor_24;
class t_bitmap_group_24;

// ------------------------------------------------------------------------------
// t_adv_object_subimage_base class
// ------------------------------------------------------------------------------

class t_adv_object_subimage_base
{
public:
	// Destructor
	virtual ~t_adv_object_subimage_base() {}

	// Member functions
	virtual int				get_depth_offset() const = 0;
	virtual t_screen_rect	get_rect() const = 0;
	virtual t_screen_rect	get_rect( int frame_num ) const = 0;
	virtual bool			is_underlay() const = 0;
};

// ------------------------------------------------------------------------------
// t_adv_object_subimage_24 class
// ------------------------------------------------------------------------------

class t_adv_object_subimage_24 : public t_adv_object_subimage_base
{
};

// ------------------------------------------------------------------------------
// t_adv_object_subimage class
// ------------------------------------------------------------------------------

class t_adv_object_subimage : public t_adv_object_subimage_base
{
public:
	// Member functions
	virtual void	draw_to(
						int						frame_num,
						t_screen_rect const &	source_rect,
						t_abstract_bitmap16 &	dest,
						t_screen_point const &	dest_point,
						int						alpha = 15 ) const = 0;
	virtual void	draw_to(
						int						frame_num,
						t_abstract_bitmap16 &	dest,
						t_screen_point const &	dest_point ) const = 0;
};

// ------------------------------------------------------------------------------
// t_adv_object_image_base class template
// ------------------------------------------------------------------------------

template < typename t_derived, typename t_subimage_arg, typename t_visitor_arg >
class t_adv_object_image_base
{
public:
	// Types
	typedef std::auto_ptr< t_derived >	t_clone_ptr;
	typedef t_subimage_arg				t_subimage;
	typedef t_visitor_arg				t_visitor;

	// Destructor
	virtual ~t_adv_object_image_base();

	// Member functions
	virtual void				accept( t_visitor & visitor ) = 0;
	virtual void				accept( t_visitor & visitor ) const = 0;
	virtual t_clone_ptr			clone() const = 0;
	virtual int					get_frame_count() const = 0;
	virtual t_screen_point		get_offset() const = 0;
	virtual t_screen_rect		get_rect() const = 0;
	virtual t_screen_rect		get_rect( int frame_num ) const = 0;
	virtual t_uint16			get_sequence_type() const = 0;
	virtual t_screen_rect		get_shadow_rect() const = 0;
	virtual t_screen_rect		get_shadow_rect( int frame_num ) const = 0;
	virtual t_subimage const &	get_subimage( int subimage_num ) const = 0;
	virtual int					get_subimage_count() const = 0;
	virtual bool				hit_test( int frame_num, t_screen_point const & point ) const = 0;
	virtual	void				toggle_base_frame_draw(bool val) = 0;
};

template < typename t_derived, typename t_subimage_arg, typename t_visitor_arg >
t_adv_object_image_base< t_derived, t_subimage_arg, t_visitor_arg >::~t_adv_object_image_base()
{
}

// ------------------------------------------------------------------------------
// t_adv_object_image_24 class
// ------------------------------------------------------------------------------

class t_adv_object_image_24
	:	public	t_adv_object_image_base<
					t_adv_object_image_24,
					t_adv_object_subimage_24,
					t_adv_object_image_visitor_24 >
{
public:
	// Types
	typedef std::auto_ptr< t_adv_object_image >	t_clone_16_ptr;

	// Member functions
	virtual void			get_frames(
								t_bitmap_group_24 & bitmaps ) const = 0;
	virtual t_clone_16_ptr	clone_as_16() const = 0;
};

// ------------------------------------------------------------------------------
// t_adv_object_image class
// ------------------------------------------------------------------------------

class t_adv_object_image
	:	public	t_adv_object_image_base<
					t_adv_object_image,
					t_adv_object_subimage,
					t_adv_object_image_visitor >
{
public:
	// Member functions
	virtual void	draw_to(
						int						frame_num,
						t_screen_rect const &	source_rect,
						t_abstract_bitmap16 &	dest,
						t_screen_point const &	dest_point,
						int						alpha = 15 ) const = 0;
	virtual void	draw_to(
						int						frame_num,
						t_abstract_bitmap16 &	dest,
						t_screen_point const &	dest_point ) const = 0;
	virtual void	draw_shadow_to(
						int						frame_num,
						t_screen_rect const &	source_rect,
						t_abstract_bitmap16 &	dest,
						t_screen_point const &	dest_point ) const = 0;
	virtual void	draw_shadow_to(
						int						frame_num,
						t_abstract_bitmap16 &	dest,
						t_screen_point const &	dest_point ) const = 0;
};

#endif // !defined( ADV_OBJECT_IMAGE_H_INCLUDED )
